package com.guo.controller;

import com.guo.config.AjaxResult;
import com.guo.entity.User;
import com.guo.entity.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(tags = "用户接口",description = "用户接口详细描述")
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/find")
    @ApiOperation(value = "查找所有用户")
    public List<User> findAll(){
        return userService.queryAll();
    }


    @PostMapping("/login")
    @ApiOperation(value = "登录接口")
    public AjaxResult login(@RequestBody User user){

        return userService.login(user);
    }

    @PostMapping("/register")
    @ApiOperation(value = "注册接口")
    public AjaxResult register(@RequestBody User user){

        return userService.register(user);
    }
}
